package com.cls.business.mapper;

import com.cls.business.entity.ExpertGroup;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cls.business.vo.review.result.ReviewResultExportVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Mapper
 *
 * @author wandering
 * @date 2020-11-30 16:35:23
 */
@Repository
public interface ExpertGroupMapper extends BaseMapper<ExpertGroup> {

    @Select("select gp.*, ex.name, ex.mobile,ex.company,ex.feature_type_code,ex.district_type_code,ex.subject_type_code  from biz_expert_group gp " +
            "left join biz_expert ex on gp.expert_id = ex.expert_id " +
            "where gp.is_delete = 0 and gp.topic_id = #{topicId}")
    List<ExpertGroup> getExpertGroupByTopicId(@Param("topicId") Long topicId);


    /**
     * weiqicheng
     * 用于excel导出
     * @param period
     * @param classType
     * @return
     */
    List<ReviewResultExportVO> selectAllTopicAndExpertByPeriod(@Param("period") String period,@Param("classType") String classType);

    @Delete("DELETE FROM biz_expert_group WHERE plan_id=#{planId} AND is_delete=0 ")
    int deleteByPlanId(@Param("planId") Long planId);
}
